package Pet;

sub new {
    my $class = shift;
    my $pet   = {
        "Name"  => undef,
        "Owner" => undef,
        "Type"  => undef,
    };
    bless ($pet, $class);
}

    sub set_pet {
        my $self = shift;
        my ($name, $owner, $type) = @_;
        $self->{'Name'}  = $name;
        $self->{'Owner'} = $owner;
        $self->{'Type'}  = $type;
    }

    sub get_pet {
        my $self = shift;
        while(($key, $value) = each(%$self)) {
            print "$key: $value\n";
        }
    }

$cat = Pet->new(); # alternative form is: $cat = new Pet();
# create an object with a constructor method
$cat->set_pet("Sneaky", "Mr, Jones", "Siamese");
# access the object with an instance
$cat->get_pet;
